IOA <- function(x, y) {

################################################################################
##  
##  This program calculates association between two numerical data vectors
##  
##  parameters are as follows:
##  
##  x (numeric):          Vector 1.
##  y (numeric):          Vector 2.
##
################################################################################
##
##  Copyright (C) 2012 Tim Appelhans 
##  (adopted from Matloff 2011, The Art of R Programming)
##
##  This program is free software: you can redistribute it and/or modify
##  it under the terms of the GNU General Public License as published by
##  the Free Software Foundation, either version 3 of the License, or
##  (at your option) any later version.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
##  GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program.  If not, see <http://www.gnu.org/licenses/>.
##
##  Please send any comments, suggestions, criticism, or (for our sake) bug
##  reports to tim.appelhans@gmail.com
##
################################################################################

  
########################### FUNCTION BODY ######################################

  ## DEFINE FUNCTION TO CONVERT VECTOR TO BINARY: 
  ## 1 FOR POSITIVE STEP, -1 FOR NEGATIVE
  fundud <- function(v) {
    vud <- v[-1] - v[-length(v)]
    return(ifelse(vud > 0, 1, -1))
  }
  
  ## APPLY FINDUD TO BOTH VECTORS
  ## RETURN THE MEAN OF HOW OFTEN THEY ARE EQUAL
  ud <- lapply(list(x, y), fundud)
  return(mean(ud[[1]] == ud[[2]]))
## testing for upload - Cullen
}

## testing for upload - Conway
